/*
 * @Author       : wangzeyu 2309335887@qq.com
 * @Date         : 2023-06-25 14:28:53
 * @LastEditors  : WangZeYu
 * @LastEditTime : 2023-06-25 15:09:22
 * @FilePath     : \algorithm\bubleSort.js
 * @Description  : bubleSort 冒泡排序
 */
function bubleSort(arr){
  for(let i = 0; i < arr.length-1; i++){
    for(let j = i+1; j < arr.length; j++){
      if(arr[i] > arr[j]){
        let temp = arr[i]
        arr[i] = arr[j]
        arr[j] = temp
      }
    }
  }
  return arr
}

let a = [56,3,5,11]
console.log(bubleSort(a))